'\" te
.\"  Copyright 1989 AT&T  Copyright (c) 1997, Sun Microsystems, Inc.  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH ADDSEV 3C "June 20, 2021"
.SH NAME
addsev \- define additional severities
.SH SYNOPSIS
.nf
#include <pfmt.h>

\fBint\fR \fBaddsev\fR(\fBint\fR \fIint_val\fR, \fBconst char *\fR\fIstring\fR);
.fi

.SH DESCRIPTION
The \fBaddsev()\fR function defines additional severities for use in subsequent
calls to \fBpfmt\fR(3C) or \fBlfmt\fR(3C). It associates an integer value
\fIint_val\fR in the range [5-255] with a character \fIstring\fR, overwriting
any previous string association between \fIint_val\fR and \fIstring\fR.
.sp
.LP
If \fIint_val\fR is OR-ed with the \fIflags\fR argument passed to subsequent
calls to \fBpfmt()\fR or \fBlfmt()\fR, \fIstring\fR will be used as severity.
Passing a null \fIstring\fR removes the severity.
.SH RETURN VALUES
Upon successful completion, \fBaddsev()\fR returns \fB0\fR.  Otherwise it
returns \fB\(mi1\fR\&.
.SH USAGE
Only the standard severities are automatically displayed for the locale in
effect at runtime. An application must provide the means for displaying
locale-specific versions of add-on severities. Add-on severities are only
effective within the applications defining them.
.SH EXAMPLES
\fBExample 1 \fRExample of \fBaddsev()\fR function.
.sp
.LP
The following example

.sp
.in +2
.nf
#define Panic 5
setlabel("APPL");
setcat("my_appl");
addsev(Panic, gettxt(":26", "PANIC"));
/* .\|.\|. */
lfmt(stderr, MM_SOFT|MM_APPL|PANIC, ":12:Cannot locate database\en");
.fi
.in -2

.sp
.LP
will display the message to \fIstderr\fR and forward to the logging service

.sp
.in +2
.nf
APPL: PANIC: Cannot locate database
.fi
.in -2

.SH ATTRIBUTES
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
MT-Level	MT-safe
.TE

.SH SEE ALSO
.BR gettxt (3C),
.BR lfmt (3C),
.BR pfmt (3C),
.BR attributes (7)
